import 'package:flutter/material.dart';
import 'package:ytbusiness/config/yt_theme.dart';
import 'package:ytbusiness/utils/screen_adaptation.dart';

///语音消息
class MessageVoice extends StatefulWidget {
  ///
  final int type;

  ///
  const MessageVoice({Key key, this.type}) : super(key: key);

  @override
  _MessageVoiceState createState() => _MessageVoiceState();
}

class _MessageVoiceState extends State<MessageVoice> {
  @override
  Widget build(BuildContext context) {
    return widget.type % 2 == 0
        ? Container(
            padding: EdgeInsets.only(top: setWidth(5)),
            child: Row(
              children: [
                Container(
                  height: setWidth(42),
                  width: setWidth(150),
                  decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.circular(setWidth(10)),
                  ),
                  padding: EdgeInsets.symmetric(
                    horizontal: setWidth(10),
                  ),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: [
                      Image.asset(
                        'assets/images/voice_black.png',
                        width: setWidth(11),
                        height: setWidth(15),
                        fit: BoxFit.fill,
                      ),
                      SizedBox(
                        width: setWidth(5),
                      ),
                      Text(
                        '20”',
                        style: TextStyle(
                          color: Color(0xff323232),
                          fontSize: setSp(15),
                        ),
                      ),
                    ],
                  ),
                ),
                SizedBox(
                  width: setWidth(5),
                ),

                //未读标记
                Container(
                  height: setWidth(6),
                  width: setWidth(6),
                  decoration: BoxDecoration(
                      color: Color(0xffFA453B),
                      borderRadius: BorderRadius.circular(30)),
                ),
              ],
            ),
          )
        : Container(
            padding: EdgeInsets.only(top: setWidth(5)),
            child: Row(
              children: [
                //未读标记
                Container(
                  height: setWidth(6),
                  width: setWidth(6),
                  decoration: BoxDecoration(
                      color: Color(0xffFA453B),
                      borderRadius: BorderRadius.circular(30)),
                ),
                SizedBox(
                  width: setWidth(5),
                ),

                Container(
                  height: setWidth(42),
                  width: setWidth(150),
                  decoration: BoxDecoration(
                    color: YTTheme.theme,
                    borderRadius: BorderRadius.circular(setWidth(10)),
                  ),
                  padding: EdgeInsets.symmetric(
                    horizontal: setWidth(10),
                  ),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.end,
                    children: [
                      Text(
                        '20”',
                        style: TextStyle(
                          color: Colors.white,
                          fontSize: setSp(15),
                        ),
                      ),
                      SizedBox(
                        width: setWidth(5),
                      ),
                      Image.asset(
                        'assets/images/voiceimage.png',
                        width: setWidth(11),
                        height: setWidth(15),
                        fit: BoxFit.fill,
                      ),
                    ],
                  ),
                ),
              ],
            ),
          );
  }
}
